package com.cavedroid;

import java.util.Stack;

import android.app.Activity;
import android.view.View;

public class LayoutStack extends Stack<Integer> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Activity context;
	
	public LayoutStack(Activity c) {
		super();
		context = c;
	}
	
	public Integer push(Integer item) {
		super.push(item);
		context.findViewById(item).setVisibility(View.VISIBLE);
		return item;
	}
	
	public Integer pop() {
		Integer temp = super.pop();
		context.findViewById(temp).setVisibility(View.GONE);
		return temp;
	}
	
	public Integer replace(Integer item) {
		if (!empty()) {
			context.findViewById(pop());
		}
		return push(item);
	}
	

}
